package com.mercury.ec.module.air.dal.mysql.order;

import com.mercury.ec.framework.common.pojo.PageResult;
import com.mercury.ec.framework.mybatis.core.mapper.BaseMapperX;
import com.mercury.ec.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.mercury.ec.module.air.controller.admin.order.vo.orderpnrlog.AirOrderPnrLogPageReqVO;
import com.mercury.ec.module.air.dal.dataobject.order.AirOrderPnrLogDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 机票订单PNR日志 Mapper
 *
 * @author hesx
 */
@Mapper
public interface AirOrderPnrLogMapper extends BaseMapperX<AirOrderPnrLogDO> {

    default PageResult<AirOrderPnrLogDO> selectPage(AirOrderPnrLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AirOrderPnrLogDO>()
                .eqIfPresent(AirOrderPnrLogDO::getOrderId, reqVO.getOrderId())
                .likeIfPresent(AirOrderPnrLogDO::getPnr, reqVO.getPnr())
                .likeIfPresent(AirOrderPnrLogDO::getContent, reqVO.getContent())
                .betweenIfPresent(AirOrderPnrLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AirOrderPnrLogDO::getId));
    }

    default List<AirOrderPnrLogDO> selectByOrderId(Long orderId) {
        return selectList(AirOrderPnrLogDO::getOrderId, orderId);
    }
}
